<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<!-- The path assumes that this XSL file will reside on level below the XSL directory -->
	<xsl:include href="../xsl_include/global_xsl_header_inc.xsl" />
	<xsl:strip-space elements="*" />
	<!-- Begin XSL Template Specifications-->
	<xsl:template name="iframe">
		<xsl:param name="primaryNav" />
		<xsl:param name="secondaryNav" />
		<xsl:param name="tertiaryNav" />
		<xsl:param name="queryStringSuffix" />

		<iframe scrolling="auto" frameborder="0" width="100%" height="100%">
			<xsl:attribute name="src">
				<xsl:choose>
					<xsl:when test="$secondaryNav = ''">
						<xsl:choose>
							<xsl:when test="$queryStringSuffix">
								<xsl:value-of select="concat(/application_header/navigation/context[id=$primaryNav]/work_area, '?', $queryStringSuffix)" />
							</xsl:when>	
							<xsl:otherwise>
								<xsl:value-of select="/application_header/navigation/context[id=$primaryNav]/work_area" />
							</xsl:otherwise>
						</xsl:choose>					
					</xsl:when>					
					<xsl:when test="$tertiaryNav = ''">
						<!--<xsl:value-of select="/application_header/navigation/context[id=$primaryNav]/sub_context[id=$secondaryNav]/work_area" />-->
						<xsl:choose>
							<xsl:when test="$queryStringSuffix">
								<xsl:value-of select="concat(/application_header/navigation/context[id=$primaryNav]/sub_context[id=$secondaryNav]/work_area, '?', $queryStringSuffix)" />
							</xsl:when>	
							<xsl:otherwise>
								<xsl:value-of select="/application_header/navigation/context[id=$primaryNav]/sub_context[id=$secondaryNav]/work_area" />
							</xsl:otherwise>
						</xsl:choose>					
					</xsl:when>				
					<xsl:otherwise>
						<!--<xsl:value-of select="/application_header/navigation/context[id=$primaryNav]/sub_context[id=$secondaryNav]/sub_context[id=$tertiaryNav]/work_area" />-->
						<xsl:choose>
							<xsl:when test="$queryStringSuffix">
								<xsl:value-of select="concat(/application_header/navigation/context[id=$primaryNav]/sub_context[id=$secondaryNav]/sub_context[id=$tertiaryNav]/work_area, '?', $queryStringSuffix)" />
							</xsl:when>	
							<xsl:otherwise>
								<xsl:value-of select="/application_header/navigation/context[id=$primaryNav]/sub_context[id=$secondaryNav]/sub_context[id=$tertiaryNav]/work_area" />
							</xsl:otherwise>
						</xsl:choose>							
					</xsl:otherwise>
				</xsl:choose>
			</xsl:attribute>
		</iframe>
		
			<!--
			<xsl:for-each select="/application_header/navigation/context">
				<h1>outer loop</h1>
				<xsl:if test="$primaryNav = id">
					<xsl:choose>
						<xsl:when test="sub_context">
							<xsl:for-each select="sub_context">
								<h2>inner loop</h2>
								<xsl:if test="$secondaryNav = id">
									<xsl:choose>
										<xsl:when test="sub_context">
											<xsl:for-each select="sub_context">
												<h3>inner inner loop</h3>
											</xsl:for-each>
										</xsl:when>
									</xsl:choose>
								</xsl:if>
							</xsl:for-each>
						</xsl:when>
					</xsl:choose>
				</xsl:if>
			</xsl:for-each>
			-->

		<!--		
		<iframe scrolling="auto" frameborder="0" width="100%" height="100%">
			<xsl:for-each select="/application_header/navigation/context">
				<xsl:if test="$primaryNav = id">
					<xsl:choose>
						<xsl:when test="sub_context">
							<xsl:for-each select="sub_context">
								<xsl:if test="$secondaryNav = id">
									<xsl:choose>
										<xsl:when test="sub_context">
											<xsl:for-each select="sub_context">
												<xsl:if test="$tertiaryNav = id">
													<xsl:attribute name="src">
														<xsl:value-of select="work_area" />
														<xsl:value-of select="$queryStringSuffix" />
													</xsl:attribute>
												</xsl:if>
											</xsl:for-each>
										</xsl:when>
										<xsl:otherwise>
											<xsl:attribute name="src">
												<xsl:value-of select="work_area" />
												<xsl:value-of select="$queryStringSuffix" />
											</xsl:attribute>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:if>
							</xsl:for-each>
						</xsl:when>
						<xsl:otherwise>
							<xsl:attribute name="src">
								<xsl:value-of select="work_area" />
								<xsl:value-of select="$queryStringSuffix" />
							</xsl:attribute>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:if>
			</xsl:for-each>
		</iframe>
		-->
	</xsl:template>
</xsl:stylesheet>
